package com.kmproject.haifu.mvp.ui.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.http.imageloader.glide.ImageConfigImpl;
import com.jess.arms.utils.ArmsUtils;
import com.kmproject.haifu.R;
import com.kmproject.haifu.mvp.model.entity.beans.MemberFeatureBean;

import java.util.List;

public class MemberCenterMainAdapter extends BaseQuickAdapter<MemberFeatureBean, BaseViewHolder> {
    ImageLoader mglideImage;
    public MemberCenterMainAdapter(@Nullable List<MemberFeatureBean> data) {
        super(R.layout.member_center_main_item,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MemberFeatureBean item) {
        if (mglideImage == null) {
            mglideImage = ArmsUtils.obtainAppComponentFromContext(mContext).imageLoader();
        }
        mglideImage.loadImage(mContext, ImageConfigImpl.builder().url(item.getImage()).isCenterCrop(true)
                .imageView(helper.<ImageView>getView(R.id.member_center_main_item))
                .build());
         helper.<TextView>getView(R.id.member_center_main_item_name).setText(item.getFunctionName());
         if (item.getValue()!=null&&! TextUtils.isEmpty(item.getValue()))
         {
             helper.<TextView>getView(R.id.member_center_main_item_num).setText(item.getDescription());
         }

    }
}
